{% load static %}
<!doctype html>
<html lang="zh-CN">

<head>
    <!-- 必须的 meta 标签 -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap 的 CSS 文件 -->
    <link rel="stylesheet" href="{% static 'mainapp/bootstrap5/css/bootstrap.css' %}">

    {% block stylefiles %}
        <style>
            body {
                padding-bottom: 500px;
            }
        </style>
    {% endblock %}
    <title>{% block title %} 首页 {% endblock %}</title>
</head>

<body>

<div class="container-fluid bg-dark">
    <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
        <a class="navbar-brand" href="#">OQC报告工具</a>
    </nav>
</div>
<div class="container-fluid row">
    <div class="col-2 bg-body-secondary text-dark text-left">
        <ul>
            {% if request.session.role == 'admin' %}
            <li class="mt-3"><a class="text-decoration-none text-dark"
                                href="/mainapp/product_lot_rel_list/">产品批次关系管理</a></li>
            {% endif %}
            {% if request.session.role %}
            <li class="mt-3"><a class="text-decoration-none text-dark"
                                href="/mainapp/product_batch_info_list/">批次产品信息管理</a></li>
            {% endif %}
            {% if request.session.role == 'admin' %}
                <li class="mt-3"><a class="text-decoration-none text-dark"
                                    href="/mainapp/users/">用户管理</a></li>
            {% endif %}

            {% if request.session.username %}
                <li class="nav-item mt-5">
                    <a class="nav-link" href="#">欢迎，{{ request.session.username }}
                        (角色：{{ request.session.role }})</a>
                </li>
                <li class="nav-item mt-1">
                    <a class="nav-link" href="{% url 'logout' %}">登出</a>
                </li>
            {% else %}
                <li class="nav-item mt-3">
                    <a class="nav-link" href="{% url 'login' %}">用户登录</a>
                </li>
            {% endif %}
        </ul>
    </div>
    <div class="col-10 pt-3">{% block content %} 这是正文部分 {% endblock %}</div>
</div>




{% block jsfiles %}  {% endblock %}
<script src="{% static 'mainapp/bootstrap5/js/jquery.min.js' %}"></script>
<script src="{% static 'mainapp/bootstrap5/js/bootstrap.bundle.js' %}"></script>
{% block jscodes %}  {% endblock %}
</body>

</html>